package base.juc;

import java.util.concurrent.*;

public class CallableDemo2 {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        Callable myThread = new MyThread();
        FutureTask<Integer> futureTask = new FutureTask<Integer>(myThread);
        new Thread(futureTask,"t1").start();
        System.out.println(futureTask.get());


    }

    static class MyThread implements Callable {

        @Override
        public Integer call() throws Exception {
            System.out.println("callable......");
            return 1;
        }
    }
}
